﻿/// <reference path="http://apps.bdimg.com/libs/jquery/1.6.4/jquery.min.js" />
//#region juery 扩展
$.extend({
    isN: function (o) { return typeof o == "number"; },
    isInt: function (o) { return $.isN(o) && Math.round(o) == o; },
    round: function (n, mantissa) { if (!mantissa) mantissa = 0; if (mantissa <= 0) return Math.round(n); var v = 1; for (var i = 0; i < mantissa; i++) v *= 10; return Math.round(n * v) / v; },
    formatMoney: function (num, n) {
        num = String(num.toFixed(n ? n : 2));
        var re = /(-?\d+)(\d{3})/;
        while (re.test(num)) num = num.replace(re, "$1,$2");
        return n ? num : num.replace(/^([0-9,]+\.[1-9])0$/, "$1").replace(/^([0-9,]+)\.00$/, "$1");;
    },
    formatMoneyToDeciamil: function (moneyStr) {
        return parseFloat(moneyStr.replace(",", ""));

    }
});
//#endregion
